#include <stdio.h>

int main() {
    int bjt;
    scanf("%d", &bjt);
    int utc = bjt - 800;
    if (utc < 0) {
        utc += 2400;
    }
    printf("%d\n", utc);
    return 0;
}